---
title: "ExpressibleByNilLiteral"
description: "Swift documentation for 'ExpressibleByNilLiteral'"
keywords: ""
layout: "default"
root: "/v5.1"
---

<div class="intro-declaration"><code class="language-swift">protocol ExpressibleByNilLiteral</code></div><p>A type that can be initialized using the nil literal, <code>nil</code>.</p>
<table class="standard"><tr><th id="conforming-types">Conforming Types</th><td><code class="inherits">Optional</code></td></tr></table><div class="discussion comment"><p><code>nil</code> has a specific meaning in Swift---the absence of a value. Only the
<code>Optional</code> type conforms to <code>ExpressibleByNilLiteral</code>.
<code>ExpressibleByNilLiteral</code> conformance for types that use <code>nil</code> for other
purposes is discouraged.</p>
</div><h3>Initializers</h3><div id="init_nilLiteral-c798df068cf572edeb7077b1637a3b9e" class="declaration"><a class="toggle-link" href="#comment-init_nilLiteral-c798df068cf572edeb7077b1637a3b9e">init init(nilLiteral:)</a> <span class="required">Required</span><div class="comment collapse in" id="comment-init_nilLiteral-c798df068cf572edeb7077b1637a3b9e"><p>Creates an instance initialized with <code>nil</code>.</p>
<h4>Declaration</h4><code class="language-swift">init(nilLiteral: ())</code></div></div>